package org.lei.gift.controller;

import org.lei.gift.dto.PhoneCodeDto;
import org.lei.gift.service.ICommonService;
import org.lei.gift.util.AjaxResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/commons")
public class CommonController {

//    @Value("${fastdfs.prefix}")
//    private String prefix;

    @Autowired
    private ICommonService commonService;


    @GetMapping("/imgCode/{uuid}")
    public AjaxResult imgCode(@PathVariable("uuid") String uuid){
        String code = commonService.createImgCode(uuid);

        return AjaxResult.me().setResultObj(code);
    }
    @PostMapping("/phoneCode")
    public AjaxResult phoneCode(@RequestBody PhoneCodeDto phoneCodeDto){
        commonService.sendPhoneCode(phoneCodeDto);
        return AjaxResult.me();
    }

}
